-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

local map = LazyVim.safe_keymap_set
local kw = require("which-key")

map("i", "jj", "<esc>")

kw.add({
  { "<leader>r", group = "Rust" },
  { "<leader>rr", ":RustLsp runnables<CR>", desc = "Run code", mode = "n" },
  { "<leader>rt", ":RustLsp testables<CR>", desc = "Run tests", mode = "n" },
  { "<leader>rd", ":RustLsp debug<CR>", desc = "Run debug", mode = "n" },
  { "<leader>rm", ":RustLsp expandMacro<CR>", desc = "Expand macro", mode = "n" },

  -- Fitten Code
  { "<leader>i", group = "Fitten" },
  { "<leader>ie", ":Fitten explain_code<CR>", desc = "Explain code", mode = { "n", "v" } },
  { "<leader>if", ":Fitten find_bugs<CR>", desc = "Find bugs", mode = { "n", "v" } },
  { "<leader>id", ":Fitten edit_code<CR>", desc = "Edit code", mode = { "n", "v" } },
  { "<leader>io", ":Fitten optimize_code<CR>", desc = "Optimize code", mode = { "n", "v" } },
  { "<leader>ir", ":Fitten refactor_code<CR>", desc = "Refactor code", mode = { "n", "v" } },
  { "<leader>ic", ":Fitten start_chat<CR>", desc = "Start chat", mode = { "n", "v" } },
  { "<leader>it", ":Fitten toggle_chat<CR>", desc = "Toggle chat", mode = { "n", "v" } },
  { "<leader>ig", ":Fitten generate_code<CR>", desc = "Generate code", mode = { "n", "v" } },
  { "<leader>iu", ":Fitten document_code<CR>", desc = "Document code", mode = { "n", "v" } },
  { "<leader>is", ":Fitten generate_unit_test<CR>", desc = "Generate unit test", mode = { "n", "v" } },

  { "<leader>i2", group = "Translate" },
  { "<leader>i2e", ":Fitten trnslate_text_into_english<CR>", desc = "Translate to English", mode = { "n", "v" } },
  { "<leader>i2c", ":Fitten trnslate_text_into_chinese<CR>", desc = "Translate to Chinese", mode = { "n", "v" } },
})
